package com.atguigu.tingshu.account;

import com.atguigu.tingshu.account.config.FeignClientConfig;
import com.atguigu.tingshu.account.impl.AccountDegradeFeignClient;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.vo.account.AccountDeductVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 账号模块远程调用API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-account", fallback = AccountDegradeFeignClient.class, configuration = FeignClientConfig.class)
public interface AccountFeignClient {

    /**
     * 检查余额并扣减
     *
     * @param accountDeductVo 扣减信息
     * @return 结果
     */
    @PostMapping("/api/account/userAccount/checkAndDeduct")
    Result<?> checkAndDeduct(@RequestBody AccountDeductVo accountDeductVo);

    /**
     * 充值成功回调
     *
     * @param orderNo 订单号
     * @return 结果
     */
    @GetMapping("/api/account/rechargeInfo/rechargePaySuccess/{orderNo}")
    Result<?> rechargePaySuccess(@PathVariable("orderNo") String orderNo);

}
